package io.renren.modules.app.dao;

import io.renren.modules.app.entity.ImMomentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 *
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-05-25 08:44:56
 */
@Mapper
public interface ImMomentDao extends BaseMapper<ImMomentEntity> {

    @Select("SELECT m.*,mt.own,u.nickname,u.username,u.avatar FROM im_moment m ,tb_user u,im_moment_timeline mt WHERE mt.moment_id=m.id AND m.user_id=u.user_id AND mt.user_id=#{userId} ORDER BY m.id DESC")
    List<ImMomentEntity> selectListByUserId(Long userId);
}
